<table width="100%"><tr><td width="20%">
<a href="../index.html">&lt; index</a><br />
<a href="index.html">&lt; 2. Console emulator</a><br />
<a href="console_init.html">&lt; 2.1 Initializing the console</a>
</td><td width="60%">
<p align="center">
=====================================<br />
2.1.3 Using custom characters mappings<br />
=====================================<br />
</p></td><td width="20%">
</td></tr></table>
<style type="text/css">
.code { color:#444444; background-color:#EEEEEE;}
pre { color:#444444; background-color:#EEEEEE;}
table.param td { border : 1px solid #000000; }
th { background-color: #44BBFF; color: #FFFFFF }
table.none td { border : 0 }
</style>
This function allows you to map a character in the bitmap font to an ASCII code.<br />
<b>It should be called after initializing the root console with <a href="console_init_root.html">initRoot</a>.</b><br />
You can dynamically change the characters mapping at any time, allowing to use several fonts in the same screen.<br />
<br />
<a href="#2.1.3.1">2.1.3.1 Mapping a single ASCII code to a character</a><br />
<a href="#2.1.3.2">2.1.3.2 Mapping consecutive ASCII codes to consecutive characters</a><br />
<a href="#2.1.3.3">2.1.3.3 Mapping ASCII code from a string to consecutive characters</a><br />
<br />
<a name="2.1.3.1"><h4>2.1.3.1 Mapping a single ASCII code to a character</h4>
<p class="code"><pre>
C++ : static void TCODConsole::mapAsciiCodeToFont(int asciiCode, int fontCharX, int fontCharY)
C   : void TCOD_console_map_ascii_code_to_font(int asciiCode, int fontCharX, int fontCharY)
Py  : console_map_ascii_code_to_font(asciiCode, fontCharX, fontCharY)
</pre></p>
<table class="param">
<tr><th>Parameter</th><th>Description</th></tr>
<tr><td>asciiCode</td><td>ASCII code to map, between 0 and 255.</td></tr>
<tr><td>fontCharX, fontCharY</td><td>Coordinate of the character in the bitmap font (in characters, not pixels).</td></tr>
</table>
<br />
<a name="2.1.3.2"><h4>2.1.3.2 Mapping consecutive ASCII codes to consecutive characters</h4>
<p class="code"><pre>
C++ : static void TCODConsole::mapAsciiCodesToFont(int firstAsciiCode, int nbCodes, int fontCharX, int fontCharY)
C   : void TCOD_console_map_ascii_codes_to_font(int firstAsciiCode, int nbCodes, int fontCharX, int fontCharY)
Py  : console_map_ascii_codes_to_font(firstAsciiCode, nbCodes, fontCharX, fontCharY)
</pre></p>
<table class="param">
<tr><th>Parameter</th><th>Description</th></tr>
<tr><td>firstAsciiCode</td><td>first ASCII code to map, between 0 and 255.</td></tr>
<tr><td>nbCodes</td><td>Number of consecutive ASCII codes to map</td></tr>
<tr><td>fontCharX, fontCharY</td><td>Coordinate of the character in the bitmap font (in characters, not pixels) corresponding to the first ASCII code.</td></tr>
</table>
<br />
<a name="2.1.3.3"><h4>2.1.3.3 Mapping ASCII code from a string to consecutive characters</h4>
<p class="code"><pre>
C++ : static void TCODConsole::mapStringToFont(const char *s, int fontCharX, int fontCharY)
C   : void TCOD_console_map_string_to_font(const char *s, int fontCharX, int fontCharY)
Py  : console_map_string_to_font(s, fontCharX, fontCharY)
</pre></p>
<table class="param">
<tr><th>Parameter</th><th>Description</th></tr>
<tr><td>s</td><td>String containing the ASCII codes to map.</td></tr>
<tr><td>fontCharX, fontCharY</td><td>Coordinate of the character in the bitmap font (in characters, not pixels) corresponding to the first ASCII code in the string.</td></tr>
</table>
